#include<iostream>
using namespace std;

const int N=5050;
int arr[N];

int fd(int x)
{
	return arr[x]==x? x: arr[x] = fd(arr[x]);
}



int main()
{
	int n, m, p;
	cin>>n>>m>>p;
	
	for(int i=1; i<=n; i++) arr[i]=i;
	
	while(m--)
	{
		int i, j; cin>>i>>j;
		arr[fd(i)] = fd(j);
	}
	
	while(p--)
	{
		int i, j; cin>>i>>j;
		if(fd(i) == fd(j)) cout<<"Yes"<<endl;
		else cout<<"No"<<endl;
	}
	return 0;
}
